<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>盒模型</title>
    <style>
        .box1 {
            width: 100px;
            height: 100px;
            margin: 10px;
            padding: 10px;
            border: 1px solid #000;
            background-color: red;
            box-sizing: content-box;
        }

        .box2 {
            width: 100px;
            height: 100px;
            margin: 10px;
            padding: 10px;
            border: 1px solid #000;
            box-sizing: border-box;
            background-color: green;
        }
    </style>
</head>

<body>
    <div class="box1"></div>
    <div class="box2"></div>
</body>

</html>